
// pages/test/test.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navList : ["首页","动画", "番剧","首页","动画", "番剧","首页","动画", "番剧","首页","动画", "番剧"],
    currentNavSearchIndex: 0,
    imgList: []
  },

  handleNavSearch: function(event){
    console.log('handleNavSearch', event);
    const { dataset: { index } } = event.currentTarget;
    this.setData({
      currentNavSearchIndex: index
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.request({
      url: 'http://127.0.0.1:3000/mock/127/getImgList',
      method: "POST",
      success: (res) => {
        console.log('res', res);
        const { data = [] } = res?.data||{};
        this.setData({
          imgList: data
        })
      }
    })
  },
  routerToHome(...args){
    console.log('动态跳转！', ...args);
    wx.navigateTo({
      url: '/pages/index/index?a=1',
      success: function(){
        console.log('动态跳转success！');
      }

    })
  },
  handleLoadBILIBILI(){
    wx.downloadFile({
      url: "https://dl.hdslb.com/mobile/latest/iBiliPlayer-html5_search_baidu.apk",
      success: function(){
        console.log('success')
      },
      fail: function(){
        console.log('fail')
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})